function ri = computeResistantForce(elements,model,...
    processInfo)
%the structure resistant force was actually the full ri without applying
%boundary condition
mesh = model.getMesh();
nf = mesh.countFaces();
nn = mesh.countNodes();
dim = 2;
ri = zeros(dim*nn,1);
if strcmp(processInfo.integrationType,'implicit')
    for i=1:nf
        rie = computeRie(i,elements,model);
        f = mesh.getFace(i-1);
        na = f.getNodes();
        nnf = f.countModes();
        dofs = zeros(dim*nnf,1);
        for j=1:nnf
            nodeid = na(j).getId();
            dofs(dim*j-1) = dim*nodeid - 1;
            dofs(dim*j) = dim*nodeid;
        end
        for j=1:dim*nnf
            ri(dofs(j)) = ri(dofs(j)) + rie(j);
        end
    end
elseif strcmp(processInfo.integrationType,'implex')
    for i=1:nf
        rie = computeRieImplicit(i,elements,model);
        f = mesh.getFace(i-1);
        na = f.getNodes();
        nnf = f.countModes();
        dofs = zeros(dim*nnf,1);
        for j=1:nnf
            nodeid = na(j).getId();
            dofs(dim*j-1) = dim*nodeid - 1;
            dofs(dim*j) = dim*nodeid;
        end
        for j=1:dim*nnf
            ri(dofs(j)) = ri(dofs(j)) + rie(j);
        end
    end
end
